home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Views / Canvas Loops / CanvasRowLoop.cp < prev    next >
Text File  |  2000-06-23  |  705b  |  38 lines

  1. // CanvasRowLoop.cp
  2.  
  3. #ifndef CanvasRowLoop_h
  4. #include "CanvasRowLoop.h"
  5. #endif
  6.  
  7. CanvasRowLoop::CanvasRowLoop( const Canvas& theParent,
  8.                                         Range32 firstRow )
  9.   : parent( theParent ),
  10.      canvas( theParent ),
  11.      row( firstRow )
  12.   {
  13.     if ( Unfinished() )
  14.       {
  15.         canvas.SliceHorizontally( row );
  16.         canvasMaintainer.Use( canvas );
  17.       }
  18.      else
  19.         canvasMaintainer.UseNone();
  20.   }
  21.  
  22. void CanvasRowLoop::NextRow( uint32 height )
  23.   {
  24.     Assert( Unfinished() );
  25.  
  26.     Assert( height <= maxint32 - row.End() );
  27.     row = Range32( row.End(), row.End() + height );
  28.     
  29.     if ( Unfinished() )
  30.       {
  31.         canvas = parent;
  32.         canvas.SliceHorizontally( row );
  33.         canvasMaintainer.Use( canvas );
  34.       }
  35.      else
  36.         canvasMaintainer.UseNone();
  37.   }
  38.